<html>
<head>
<script src="jquery.js"></script>
<script>
function check_login(login, password)
{
	$.post(
		"check_login.php",
		{
			login: login,
			password: password
		},
		function (data)
		{
			if (data == "LOGIN_OK")
				alert("Vous etes connectes.");
			else { 
				$("#inscription").show();
			}
		}
	);
}
function inscription()
{
	$.post(
		"inscription.php",
		{
			login: $("#login").val(),
			password: $("#password").val(),
			nom: $("#nom").val(),
			prenom: $("#prenom").val(),
			date_naissance: $("#date_naissance").val(),
			adresse: $("#adresse").val()
		},
		function (data)
		{
			check_login($("#login").val(), $("#password").val());
		}
	);	
}
</script>
</head>
<body>
<form method="post" enctype="multipart/form-data">
<label>Login</label><input type="text" id="login_login" /><br />
<label>Password</label><input type="password" id="login_password" /><br />
<input type="button" value="Envoyer" onClick="check_login($('#login_login').val(), $('#login_password').val());" /><br />
</form>
<div id="inscription" style="display:none;">
<form>
<label>Login</label><input type="text" id="login" /><br />
<label>Password</label><input type="text" id="password" /><br />
<label>Nom</label><input type="text" id="nom" /><br />
<label>Prenom</label><input type="text" id="prenom" /><br />
<label>Date de naissance</label><input type="text" id="date_naissance" /><br />
<label>Adresse</label><input type="text" id="adresse" /><br />
<input type="button" value="Envoyer" onClick="inscription();" /><br />
</form>
</div>
</body>
</html>